//
//  DiscoveryBrandTableViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/24.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "DiscoveryBrandTableViewCell.h"

@interface DiscoveryBrandTableViewCell ()

@property (strong, nonatomic) UIImageView *bgIV;

@property (strong, nonatomic) UIView *propagandaView;
@property (strong, nonatomic) UILabel *propagandaL;

@property (strong, nonatomic) UIButton *storeUpBtn;

@property (strong, nonatomic) UIView *brandView;
@property (strong, nonatomic) UIImageView *brandLogoIV;
@property (strong, nonatomic) UILabel *titileL;
@property (strong, nonatomic) UILabel *desL;
@property (strong, nonatomic) UIView *enterBrandView;
@property (strong, nonatomic) UILabel *enterBrandL;

@end

@implementation DiscoveryBrandTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView addSubview:self.bgIV];
        
        [self.contentView addSubview:self.propagandaView];
        [self.propagandaView addSubview:self.propagandaL];
        
        [self.contentView addSubview:self.storeUpBtn];
        
        [self.contentView addSubview:self.brandView];
        [self.brandView addSubview:self.brandLogoIV];
        [self.brandView addSubview:self.titileL];
        [self.brandView addSubview:self.desL];
        [self.brandView addSubview:self.enterBrandView];
        [self.contentView addSubview:self.enterBrandL];
        
    }
    
    return self;
}

#pragma mark -进入品牌
- (void)enterBrandClick:(UIGestureRecognizer *)recognizer {\
    
    NSLog(@"进入品牌");
}


#pragma mark -收藏点击
- (void)storeUpClick:(UIButton *)btn {
    
    NSLog(@"收藏点击");
    
}



- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [self.bgIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.centerY.mas_equalTo(weakSelf.contentView.mas_centerY);
        make.width.mas_equalTo(jisuan(750));
        make.height.mas_equalTo(jisuan(500));
        
    }];
    [self.propagandaView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(20));
        make.top.mas_equalTo(weakSelf.contentView.mas_top).with.offset(jisuan(250));
        make.width.mas_equalTo(jisuan(250));
        make.height.mas_equalTo(jisuan(40));
        
    }];
    [self.propagandaL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(weakSelf.propagandaView.mas_centerX);
        make.centerY.mas_equalTo(weakSelf.propagandaView.mas_centerY);
//        make.width.mas_equalTo(jisuan(250));
//        make.height.mas_equalTo(jisuan(40));
        
    }];
    
    [self.storeUpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(weakSelf.contentView.mas_right).with.offset(-jisuan(20));
        make.centerY.mas_equalTo(weakSelf.propagandaView.mas_centerY);
        make.width.mas_equalTo(jisuan(44));
        make.height.mas_equalTo(jisuan(44));
        
    }];
    [self.brandView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.contentView.mas_left).with.offset(jisuan(20));
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-jisuan(20));
        make.width.mas_equalTo(jisuan(560));
        make.height.mas_equalTo(jisuan(160));
        
    }];
    [self.brandLogoIV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(weakSelf.brandView.mas_centerY);
        make.left.mas_equalTo(weakSelf.brandView.mas_left).with.offset(jisuan(10));
        make.width.mas_equalTo(jisuan(120));
        make.height.mas_equalTo(jisuan(64));
        
    }];
    [self.enterBrandView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(weakSelf.brandView.mas_centerY);
        make.right.mas_equalTo(weakSelf.brandView.mas_right).with.offset(-jisuan(30));
        make.width.mas_equalTo(jisuan(100));
        make.height.mas_equalTo(jisuan(40));
        
    }];
    [self.enterBrandL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.mas_equalTo(weakSelf.enterBrandView.mas_centerY);
        make.centerX.mas_equalTo(weakSelf.enterBrandView.mas_centerX);

    }];

    [self.titileL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.brandLogoIV.mas_right).with.offset(jisuan(20));
        make.right.mas_equalTo(weakSelf.enterBrandView.mas_left).with.offset(-jisuan(20));
        make.top.mas_equalTo(weakSelf.brandView.mas_top).with.offset(jisuan(42));
        
    }];
    [self.desL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(weakSelf.brandLogoIV.mas_right).with.offset(jisuan(20));
        make.right.mas_equalTo(weakSelf.enterBrandView.mas_left).with.offset(-jisuan(20));
        make.top.mas_equalTo(weakSelf.titileL.mas_bottom).with.offset(jisuan(30));
        
    }];
}

#pragma mark -lazy
- (UIImageView *)bgIV {
    
    if (!_bgIV) {
        
        _bgIV = [[UIImageView alloc] init];
        _bgIV.backgroundColor = WhiteColor;
        _bgIV.contentMode = UIViewContentModeScaleAspectFit;
        _bgIV.image = [UIImage imageNamed:@"brandContentCellBG"];
        
    }
    
    return _bgIV;
}

- (UIView *)propagandaView {
    
    if (!_propagandaView) {
        
        _propagandaView = [[UIView alloc] init];
        _propagandaView.backgroundColor = WhiteColor;
        
        
        _propagandaView.layer.cornerRadius = jisuan(20);
        _propagandaView.layer.masksToBounds = YES;
        
    }
    
    return _propagandaView;

}

- (UILabel *)propagandaL {
    
    if (!_propagandaL) {
        
        _propagandaL = [[UILabel alloc] init];
        _propagandaL.text = @"引领潮流，无NB 不NB";
        _propagandaL.textColor = Colorff0000;
        _propagandaL.font = Font(24);
        _propagandaL.textAlignment = NSTextAlignmentCenter;

    
    }
    
    return _propagandaL;
}

- (UIButton *)storeUpBtn {
    
    if (!_storeUpBtn) {
        
        _storeUpBtn = [[UIButton alloc] init];
        [_storeUpBtn setImage:[UIImage imageNamed:@"storeUpBG"] forState:UIControlStateNormal];
        [_storeUpBtn setImage:[UIImage imageNamed:@"storeUpBG"] forState:UIControlStateSelected];
        
        [_storeUpBtn addTarget:self action:@selector(storeUpClick:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    
    return _storeUpBtn;
}

- (UIView *)brandView {
    
    if (!_brandView) {
        
        _brandView = [[UIView alloc] init];
        _brandView.backgroundColor = WhiteColor;
        
        _brandView.layer.cornerRadius = jisuan(10);
        _brandView.layer.masksToBounds = YES;
        
    }
    
    return _brandView;
    
}

- (UIImageView *)brandLogoIV {
    
    if (!_brandLogoIV) {
        
        _brandLogoIV = [[UIImageView alloc] init];
        _brandLogoIV.backgroundColor = WhiteColor;
        _brandLogoIV.contentMode = UIViewContentModeScaleAspectFit;
        _brandLogoIV.image = [UIImage imageNamed:@"brandVcContentLogoBG"];
        
    }
    
    return _brandLogoIV;
}

- (UILabel *)titileL {
    
    if (!_titileL) {
        
        _titileL = [[UILabel alloc] init];
        _titileL.text = @"NEW BALANCE";
        _titileL.textColor = Color333333;
        _titileL.font = Font(24);
        _titileL.textAlignment = NSTextAlignmentLeft;
        
    }
    
    return _titileL;
}

- (UILabel *)desL {
    
    if (!_desL) {
        
        _desL = [[UILabel alloc] init];
        _desL.text = @"美国";
        _desL.textColor = Color333333;
        _desL.font = Font(20);
        _desL.textAlignment = NSTextAlignmentLeft;
        
    }
    
    return _desL;
}

- (UIView *)enterBrandView {
    
    if (!_enterBrandView) {
        
        _enterBrandView = [[UIView alloc] init];
        _enterBrandView.backgroundColor = Colorff0000;
        _enterBrandView.alpha = 0.2;
        
        _enterBrandView.layer.cornerRadius = jisuan(20);
        _enterBrandView.layer.masksToBounds = YES;
        
        UITapGestureRecognizer *enterBrandGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(enterBrandClick:)];
        [_enterBrandView addGestureRecognizer:enterBrandGesture];
        
    }
    
    return _enterBrandView;
    
}

- (UILabel *)enterBrandL {
    
    if (!_enterBrandL) {
        
        _enterBrandL = [[UILabel alloc] init];
        _enterBrandL.text = @"进入品牌";
        _enterBrandL.textColor = Colorff0000;
        _enterBrandL.font = Font(20);
        _enterBrandL.textAlignment = NSTextAlignmentCenter;
        
    }
    
    return _enterBrandL;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
